package srx.open.com.bean;

import cn.bmob.v3.BmobObject;
import cn.bmob.v3.datatype.BmobRelation;

/**
 *  课程订阅表.
 */
public class CourseSubscribe extends BmobObject {

    private static final long serialVersionUID = 1L;

    private User usertt; // 订阅用户
    private BmobRelation coursePublishh; // 课程(N) - 订阅(N)
    private int state; // 状态.

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }

    public User getUsertt() {
        return usertt;
    }

    public void setUsertt(User usertt) {
        this.usertt = usertt;
    }

    public BmobRelation getCoursePublishh() {
        return coursePublishh;
    }

    public void setCoursePublishh(BmobRelation coursePublishh) {
        this.coursePublishh = coursePublishh;
    }

    @Override
    public String toString() {
        return "CourseSubscribe{" +
                "usertt=" + usertt +
                ", coursePublishh=" + coursePublishh +
                ", state=" + state +
                '}';
    }
}
/*
// 订阅例子
User user = BmobUser.getCurrentUser(this, User.class); // 订阅的用户.

BmobRelation relation = new BmobRelation(); // 订阅的课程.
CoursePublish mCoursePublish = new CoursePublish();
mCoursePublish.setObjectId("83ce274594"); // 添加课程objectId.
relation.add(mCoursePublish);

CourseSubscribe mCourseSubscribe = new CourseSubscribe(); // 订阅.
mCourseSubscribe.setCoursePublishh(relation);
mCourseSubscribe.setState(0);   // 订阅状态.
mCourseSubscribe.setUsertt(user);
mCourseSubscribe.save(this, new SaveListener() {
... ...
}

// 查询例子 (查询某用户订阅了多少个课程)
BmobQuery<CourseSubscribe> query = new BmobQuery<CourseSubscribe>();
//coursePublishh是CourseSubscribe表中的字段，用来存储所有订阅的课程.
query.addWhereRelatedTo("coursePublishh", new BmobPointer(mCourseSubscribe));
query.findObjects(this, new FindListener<MyUser>() {
   ... ...
});
*/